<template>
	<div class="flash">
		<section v-for="item in $store.state.flashlist">
			<a href="javascript: void(0)">
				<div class="item_detail">
					<div class="detail_img">
						<div v-if="item.article_type==0" class="video_mask"></div>
						<h3>{{item.title}}</h3>
						<img src="~@/assets/img/loading.png" >
				        <img v-lazy="item.large_image_url" />
						<span v-if="item.article_type==0" class="iconfont icon-iconset0481" @click="say('hi')"></span>
					</div>
					<div class="item_info">
						<p v-if="item.ad_label" :class="{blue:item.ad_label=='广告'}">{{item.ad_label}}</p>
						<span>{{item.media_name}}</span>
						<span>评论 {{item.comment_count}}</span>
						<span>{{item.datetime|dateResult}}</span>
					</div>
				</div>
			</a>
		</section>
	</div>
</template>

<script>
	import CONFIG from "@/config";
	import axios from 'axios';
	import moment from 'moment';
	export default {
		mounted(){
            this._getFlash(),
            this.$store.commit('flash')
		},
		data(){
			return{
				newflash:[],
				bofan:true
			}
		},
		list(id){
			console.log(id)
//				location.href=""
			this.$router.push({})
		},
		filters: {
		    dateResult(time){
		      return moment(time).startOf('hour').fromNow()
		    }
		  },
		methods:{
			say: function (message) {
		      console.log(message)
		    },
			_getFlash(){                           //`_`表示私有方法
//				var url=CONFIG.domain+"/toutiao2"
				axios({
					method:'get',
					url:"/toutiao2"
				}).then((res)=>{
					console.log(res)
					this.newflash=res.data.data
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
@import "~@/assets/scss/flash";
@import "~@/assets/scss/iconfont";
</style>